<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .old {
      position: relative;
      width: 40%;
      /* height:  22.5%; */
      padding-top: 22.5%;
      background: #ccc;
      margin: auto;
    }

    .old>div {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: red;
    }

    .new {
      width: 40%;
      margin: auto;
      aspect-ratio: 40 / 40;
      background: blue;
    }
  </style>
</head>

<body>
  <div class="old">
    <div>rtdturte</div>
  </div>
  <div class="new">3452</div>
</body>

</html>